from django.urls import path, re_path
import re
from . import views
from web.views import account, home
from web.views import project
from web.views import bug
from web.views import search
from django.shortcuts import render

# 添加一个简单的视图函数用于测试删除功能
def test_delete(request):
    return render(request, 'test_delete.html')

# 添加一个更简单的删除测试视图
def simple_delete(request):
    return render(request, 'simple_delete.html')

urlpatterns = [
    re_path(r'^$', home.index, name='root_index'),
    re_path(r'test/path/', lambda request: render(request, 'test_path.html'), name='test_path'),
    re_path(r'test/navbar/', lambda request: render(request, 'test_navbar.html'), name='test_navbar'),
    re_path(r'dashboard/', home.dashboard, name='dashboard'),
    re_path(r'search/', search.search, name='search'),
    re_path(r'register/', account.register,name='register'),
    re_path(r'send/sms/', account.send_sms,name='send_sms'),
    re_path(r'login/', account.login,name='login'),
    re_path(r'code/', account.image_code,name='image_code'),
    re_path(r'index/', home.index,name='index'),
    re_path(r'project/list/', project.project_list,name='project_list'),
    re_path(r'project/add/', project.project_add,name='project_add'),
    re_path(r'project/detail/(?P<project_id>\d+)/', project.project_detail,name='project_detail'),
    re_path(r'project/delete/(?P<project_id>\d+)/', project.project_delete,name='project_delete'),
    re_path(r'dropdown/test/', project.dropdown_test,name='dropdown_test'),
    re_path(r'test/delete/', test_delete,name='test_delete'),
    re_path(r'simple/delete/', simple_delete,name='simple_delete'),
    # BUG管理相关URL
    re_path(r'project/(?P<project_id>\d+)/bug/list/', bug.bug_list,name='bug_list'),
    re_path(r'project/(?P<project_id>\d+)/bug/add/', bug.bug_add,name='bug_add'),
    re_path(r'project/(?P<project_id>\d+)/bug/detail/(?P<bug_id>\d+)/', bug.bug_detail,name='bug_detail'),
    re_path(r'project/(?P<project_id>\d+)/bug/edit/(?P<bug_id>\d+)/', bug.bug_edit,name='bug_edit'),
    re_path(r'project/(?P<project_id>\d+)/bug/delete/(?P<bug_id>\d+)/', bug.bug_delete,name='bug_delete'),
    re_path(r'project/(?P<project_id>\d+)/bug/status/update/(?P<bug_id>\d+)/', bug.bug_status_update,name='bug_status_update'),
    re_path(r'project/(?P<project_id>\d+)/bug/batch-action/', bug.bug_batch_action, name='bug_batch_action'),
]

